﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ThreadAndTaskInForm
{
    class Helper
    {
       static int i = 0;
        internal static async void AddNum(TextBox textBox1)
        {
            await Task.Delay(3000);
            int threadId = Thread.CurrentThread.ManagedThreadId;
            Console.WriteLine("Helper类中的方法线程的ID是：" + threadId);
            while (true)
            {
                await Task.Delay(500);
                textBox1.Text = (i++).ToString();
            }
        }
    }
}
